<?php

namespace App\Http\Controllers\Home;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use DB;

class IndexController extends Controller
{
	public function index()
	{

		$data[0] = DB::select('select * from types order by hot desc limit ?,12', [1]);
		$data[1] = DB::select('select * from types order by hot desc limit ?,12', [13]);
		$data[2] = DB::select('select * from types order by hot desc limit ?,12', [26]);
		foreach($data as $k =>$v)
		{
			foreach($v as $ke => $ve)
			{
				$a = array();
				$a = explode(',', $data[$k][$ke] -> name);
				$data[$k][$ke] -> name = $a[0];
			}
		}
		if($data)
		{
			return view('welcome', ['data' => $data]);
		}
	}
}
